#ifndef _FOSSIL_SINGLETON_H
#define _FOSSIL_SINGLETON_H

namespace Fossil
{
	template <typename T>
	class Singleton
	{
	public:
		static inline T* Instance()
		{
			return m_pInstance;
		}

		inline virtual void Destroy()
		{
			delete m_pInstance;
			m_pInstance = 0;
		}
	protected:
		Singleton() 
		{
			m_pInstance = (T*)this;
		}

		~Singleton() 
		{
			m_pInstance = 0;
		}

		Singleton(const Singleton& rhs) {}
		static T* m_pInstance;
	};

	template <class T> T* Singleton<T>::m_pInstance = NULL;
};

#endif//_FOSSIL_SINGLETON_H
